#include "clickedoncelabel.h"
#include <QMouseEvent>

ClickedOnceLabel::ClickedOnceLabel(QWidget *parent)
    :QLabel(parent)
{
    setCursor(Qt::PointingHandCursor);
}

void ClickedOnceLabel::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button()==Qt::LeftButton){
        emit clicked(text());
        return;
    }
    QLabel::mouseReleaseEvent(event);
}

void ClickedOnceLabel::SetState(QString normal, QString hover, QString pressed,
                                QString selected_normal, QString selected_hover, QString selected_pressed)
{
    _normal = normal;
    _hover = hover;
    _pressed = pressed;
    _selected_normal = selected_normal;
    _selected_hover = selected_hover;
    _selected_pressed = selected_pressed;
}
